package edu.groupservice;

import edu.config.RibbonConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients
// hystrix启动注解
@EnableCircuitBreaker
//用于收集 hystrix 的数据，通过可视化统计图形方式 展现出来 (单机收集)
//访问地址： http://localhost:7771/hystrix
@EnableHystrixDashboard
//在yml中ribbon配置  B v1.2 新特性  优先级 > ribbonClient > netflix默认配置
//@RibbonClient(name = "UserService",configuration = RibbonConfig.class)
@RefreshScope
public class RibbonserverApplication {

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }


    public static void main(String[] args) {
        SpringApplication.run(RibbonserverApplication.class, args);
    }


}
